package org.doubango.FrCall.Screens;
//package org.douban.frcall;
import org.doubango.FrCall.FrCall;
import org.doubango.FrCall.R;
import org.doubango.FrCall.Screens.BaseScreen.SCREEN_TYPE;
import org.doubango.FrCall.Screens.chat.ScreenChat;
import org.doubango.FrCall.Screens.chat.ScreenChatHistory;
import org.doubango.ngn.media.NgnMediaType;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.TextView;

public class showFriendInfoPage  extends BaseScreen {
	

	
	private static String TAG = showFriendInfoPage.class.getCanonicalName();
	private Button sp;
	private Button yy;
	private Button wz;
	private Button del;
	private TextView tvName; 
	private TextView tvId;
	private TextView tvSex;
	private Button tvAddress;
	private Button tvAge;
	private Button tvNote;
	private Button tvback;
	public showFriendInfoPage() {
		super(SCREEN_TYPE.FRIEND_LIST_T, TAG);
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ViewGroup.LayoutParams para = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
		addContentView(LayoutInflater.from(showFriendInfoPage.this).inflate(R.layout.show__friend_info_page, null), para);
		sp=(Button) findViewById(R.id.button1);
		yy=(Button)findViewById(R.id.button2);
		wz=(Button)findViewById(R.id.button3);
		del=(Button)findViewById(R.id.button4);
		tvName=(TextView) findViewById(R.id.call_nickname);
		tvId=(TextView) findViewById(R.id.call_id);
		tvSex=(TextView) findViewById(R.id.call_sex);
		tvAddress=(Button) findViewById(R.id.call_address);
		tvAge=(Button) findViewById(R.id.call_age);
		tvNote=(Button) findViewById(R.id.call_notename);
		tvback=(Button)findViewById(R.id.reg_select_back_to_loginpage);
		Intent i=getIntent();
		final String nickname=i.getStringExtra("nickname");
		final String id=i.getStringExtra("id");
		String sex=i.getStringExtra("sex");
		String address=i.getStringExtra("address");
		String age=i.getStringExtra("age");
		String notename=i.getStringExtra("notename");
		tvName.setText("昵称:"+nickname);
		tvId.setText("ID:"+id);
		tvSex.setText("性别:"+sex);
		tvAddress.setText("地区                       "+address);
		tvAge.setText("年龄                      "+age);
		tvNote.setText("个性签名          "+notename);
		sp.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
//				
			Intent i=new Intent(getApplicationContext(), ShiPin.class);
			i.putExtra("nickname",nickname);
			i.putExtra("id",id);
			startActivity(i);
			}
		});
		tvback.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {			
			Intent i=new Intent(getApplicationContext(), ScreenFriendList.class);
			startActivity(i);
			}
		});
		yy.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
//				
				Intent i=new Intent(getApplicationContext(),YuYin.class);
				i.putExtra("nickname",nickname);
				i.putExtra("id",id);
				startActivity(i);
			}
		});
		wz.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
////				FrCall.s_OppID =tvId.getText().toString().substring(3)+"";
				Intent i=new Intent(getApplicationContext(),ScreenChat.class);
				String[] s=id.split("@");
				FrCall.s_OppID =s[0]+"";
				startActivity(i);
			}
		});
		del.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Builder builder = new Builder(showFriendInfoPage.this);
				AlertDialog dialog2 = builder.create();
				dialog2.setMessage("确认将此好友删除吗？");
				dialog2.setButton(DialogInterface.BUTTON_POSITIVE, "确认", new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
						
					}
				});
				dialog2.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
						
					}
				});
				dialog2.show();
			}
		});
	}
	
}
